package com.guigu.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.domain.entity.SubjectLabel;
import com.guigu.exception.GlobalException;
import com.guigu.mapper.SubjectLabelMapper;
import com.guigu.service.ISubjectLabelService;
import org.springframework.stereotype.Service;

@Service
public class SubjectLabelServiceImpl extends ServiceImpl<SubjectLabelMapper, SubjectLabel> implements ISubjectLabelService {
    @Override
    public void deleteLabel(SubjectLabel subjectLabel) {
        SubjectLabel subjectLabel1 = this.getById(subjectLabel.getId());
        if(ObjectUtil.isNull(subjectLabel)){
            throw new GlobalException("标签不存在，删除失败！");
        }
        subjectLabel1.setIsDeleted(1);
        this.updateById(subjectLabel1);
    }
}
